<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 将"i love javascript very much"的每个单词的第一个字母，变为大写。 -->
    <script>
        var str = "i love javascript very much";
        var arr = str.split(" ");
        for (var i = 0; i < arr.length; i++) {
            var shou = arr[i].slice(0,1).toUpperCase();
            var a = arr[i].slice(1);
            arr[i] = shou + a;
        }
        console.log(arr.join(" "));
    </script>
</body>
</html>